<!DOCTYPE html>
<html lang="en">
  <head>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156801664-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-156801664-1');
</script>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="<%= @title %>" />
    <title>
      <% if defined?(@title) && @title != '' -%>
         <%= @title %>
      <% else %>
      Structure and Interpretation of Computer Programs, JavaScript Adaptation
      <% end -%>
    </title>

    <%= csrf_meta_tags %>

    <!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
    -->
    <link href="https://fonts.googleapis.com/css?family=Inconsolata&display?swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Droid+Sans|Droid+Serif" rel="stylesheet">
    <%= stylesheet_link_tag "application", :media => "all" %>

   <%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>

<!--    <%= favicon_link_tag 'lambda.png', :rel => 'shortcut icon', :type => 'image/png' %> -->

    <!-- for support of progressive web app, see github README -->
    <link rel="manifest" href="/static/manifest.json">

    <script src="https://code.jquery.com/jquery-3.2.1.min.js" 
		     	  integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
	          crossorigin="anonymous">
    </script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
    
    <!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script> -->
    <script type="text/javascript" 
      src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=TeX-AMS-MML_HTMLorMML-full">
    </script>
   <!--  <script type="text/javascript" 
      src="../MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full">
    </script> -->

    <%= javascript_include_tag "application" %>

    <!-- Rendering inline LaTeX -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"] ],
          processEscapes: true,
          jax: ["input/TeX","output/HTML-CSS"]
        }
      });
    </script>
    <!--<script src="/mathjax/MathJax.js?config=TeX-AMS_HTML-full.js" type="text/javascript"></script>-->
    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js" type="text/javascript"></script>
    <![endif]-->
  </head>
  <body>

    
    <!-- support for progressive web app, see README -->
    <script>
      if ('serviceWorker' in navigator && !navigator.serviceWorker.controller) {
          navigator.serviceWorker.register("/sw.js").then(function(reg) {
              console.log("Service worker has been registered for scope: " + reg.scope);
          });
      }
    </script>

     <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top justify-content-between">
       <button id="btn" class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#nav-sidebar" aria-controls="nav-sidebar" aria-expanded="false" aria-label="Toggle navigation" title="navigation">
         <span class="navbar-toggler-icon"></span>
       </button>
       <span class="navbar-brand-short"><a title="Go back to front page" href="<%= chapters_path %>/.." class="gray">SICP &mdash; JS</a></span>
       <span class="navbar-brand-long" ><a title="Go back to front page" href="<%= chapters_path %>/.." class="gray">Structure and Interpretation
            of Computer Programs &mdash; JavaScript Adaptation</a></span>

       <!-- edit the search engine by visiting: 
	    https://cse.google.com/cse/setup/basic?cx=015760785273492757659:nc_tznrzlsg 
	       -->
       <form class="form-inline ml-auto" id="xxx">
         <div id="search-box">
	         <script>
	           (function() {
	               var cx = "015760785273492757659:nc_tznrzlsg";
	               var gcse = document.createElement("script");
	               gcse.type = "text/javascript";
	               gcse.async = true;
	               gcse.src = "https://cse.google.com/cse.js?cx=" + cx;
	               var s = document.getElementsByTagName("script")[0];
	               s.parentNode.insertBefore(gcse, s);
	           })();
	           window.onload = function()
	           { 
	               var searchBox =  document.getElementById("gsc-i-id1");
	               searchBox.placeholder="search web edition";
	               searchBox.title="search web edition"; 
	           }
	         </script>
	         <gcse:search></gcse:search>
         </div>
       </form>
       <span class="navbar-brand-short">
         &nbsp;
         &nbsp;
         <a href="https://sicp.comp.nus.edu.sg/source/" title="Go to the Source language(s) definition(s)" class="gray">S</a>
       </span>
       <span class="navbar-brand-long">
         &nbsp;
         &nbsp;
         <a href="https://sicp.comp.nus.edu.sg/source/" title="Go to the Source language(s) definition(s)" class="gray">Source</a>
       </span>
     </nav>
     
     <div class="container scroll">

       <div class="collapse" id="nav-sidebar" role="tablist" aria-multiselectable="true">
	 <!-- insert a dummy entry, to give one extra line of space -->
         <a class="navbar-brand" href=".">&nbsp;</a>
         <% Chapter.roots.all.order(:order).each do |chapter| %>
         <%= content_links(chapter, "nav-sidebar", "sidebar").html_safe %>
         <% end %>
       </div>

           <%= yield %>
     </div><!-- /.container -->


     <!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
     -->
   </body>
</html>
